home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000141_icon-group-sender _Thu May 5 16:22:56 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 24 May 1994 15:06:33 MST
  2. Path: ucbvax!cis.ohio-state.edu!math.ohio-state.edu!sdd.hp.com!col.hp.com!csn!server!usenet
  3. From: cheyenne@witsend.stortek.com (Cheyenne Wills)
  4. Newsgroups: comp.lang.icon
  5. Subject: Re: Spitbol vs. Icon
  6. Message-Id: <CpC86B.K2C@stortek.com>
  7. Date: 5 May 94 16:22:56 GMT
  8. References: <1994May3.191711.12437@midway.uchicago.edu> <Cp8yyL.152@stortek.com> <1994May4.161502.9405@cs.rit.edu> <1994May5.012816.4786@midway.uchicago.edu>
  9. Sender: usenet@stortek.com
  10. Reply-To: cheyenne@witsend.stortek.com (Cheyenne Wills)
  11. Organization: Storage Technology Corp.
  12. Lines: 42
  13. Nntp-Posting-Host: witsend.stortek.com
  14. X-Newsreader: IBM NewsReader/2 v1.00
  15. Apparently-To: icon-group@cs.arizona.edu
  16. Status: RO
  17. Errors-To: icon-group-errors@cs.arizona.edu
  18.  
  19. In <1994May5.012816.4786@midway.uchicago.edu>, goer@quads.uchicago.edu (Richard L. Goerwitz) writes:
  20. >Nicolas M Williams writes:
  21. >>
  22. >>What about Icon library routines for handling regular expressions? I'd
  23. >>love something like that, Icon would leave perl in the dust....
  24. >
  25. >Bob Alexander wrote some, and they're pretty good.  They should be
  26. >in recent library releases.
  27. >
  28. >--
  29. >
  30. >   -Richard L. Goerwitz          goer%midway@uchicago.bitnet
  31. >   goer@midway.uchicago.edu          rutgers!oddjob!ellis!goer
  32.  
  33. Just a comment about regular expressions and Icon.  One can view
  34. regular expressions as an "assembly language" for a string matching
  35. engine.  They are extremely powerful, and also extremely "cryptic"
  36.  
  37. You can code the same "patterns" in straight Icon that will probably
  38. run "faster".
  39.  
  40. For example:
  41.    "^[A-Z][A-Z0-9]* *[A-Z]*$"
  42.  
  43. can be "matched" by the following Icon segment
  44.  
  45.    line ?
  46.     pos(1) &
  47.     any(&ucase) & move(1) &
  48.     tab(many(&ucase++&digits)) &
  49.     tab(many(' ')) &
  50.     tab(many(&ucase)) &
  51.     pos(0)
  52.  
  53. +--------------------------------------+---------------------------------+
  54. | +-----+                   | Cheyenne Wills          |
  55. | |    |      "From here on up it is  | Storage Technology Corporation  |
  56. | |  +--+--+     downhill all the way" | 2270 South 88th St.             |
  57. | |  |    |  |                   | Louisville, Co. 80028-4232     |
  58. | +--+--+  |   These are not the       |                 |
  59. |    |       |   opinions or views of    | Cheyenne_Wills@stortek.com     |
  60. |    +-----+   Storage Technology      | cheyenne@witsend.stortek.com     |
  61. +--------------------------------------+---------------------------------+
  62.